package ytmc.setup;


/**
 * List of all supported audio qualities
 *
 * @author Kicok
 */
public enum AudioQuality
{
    QUAL_ORIGINAL( "Jakość oryginalna" ),
    QUAL_64( "64 kbps" ),
    QUAL_96( "96 kbps" ),
    QUAL_128( "128 kbps" ),
    QUAL_160( "160 kbps" ),
    QUAL_192( "192 kbps" ),
    QUAL_224( "224 kbps" ),
    QUAL_320( "320 kbps" );


    private AudioQuality( String friendlyName )
    {
        this.friendlyName = friendlyName;
    }


    private String friendlyName;

    public String getFriendlyName()
    {
        return friendlyName;
    }


    public static final AudioQuality DEFAULT_QUALITY = AudioQuality.QUAL_ORIGINAL;

    public static AudioQuality get( int i )
    {
        return AudioQuality.values()[i];
    }

    public static AudioQuality get( String friendlyName )
    {
        return get( friendlyName, DEFAULT_QUALITY );
    }

    public static AudioQuality get( String friendlyName, AudioQuality defaultAudioQuality )
    {
        for( AudioQuality audioQuality : AudioQuality.values() )
        {
            if( audioQuality.getFriendlyName().equalsIgnoreCase( friendlyName ) )
            {
                return audioQuality;
            }
        }

        return defaultAudioQuality;
    }


    public static String[] friendlyNames()
    {
        int i = 0;
        int len = AudioQuality.values().length;

        String[] friendlyNames = new String[len];
        for( AudioQuality audioQuality : AudioQuality.values() )
        {
            friendlyNames[i] = audioQuality.getFriendlyName();
            i++;
        }

        return friendlyNames;
    }
}
